package com.itheima.easy.mapper;

import com.github.pagehelper.Page;
import com.itheima.easy.dto.ApplicationsDto;
import com.itheima.easy.enums.Applications;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDateTime;
import java.util.List;

/**
* <p>
* applications Mapper 接口
* </p>
* @author sjqn
* @since 2023-06-28 16:45:59
*/
@Mapper
public interface ApplicationsMapper  {

    public void insert(Applications applications);

    @Update("update applications set status = #{status},finish_time = #{now} where code = #{code}")
    void updateStatus(@Param("code") String code, @Param("now")LocalDateTime now,@Param("status") Integer status);

    Page<List<Applications>> selectByPage(ApplicationsDto applicationsDto);

    @Select("select * from applications where code = #{code} ")
    Applications selectByCode(@Param("code") String code);


    void update(Applications applications);
}